/**
 * @(#) AvionicsEquipment.java
 */

package cn.edu.sjtu.se.dslab.component.data;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

@Entity
@Table(name = "avionics_equipment")
@PrimaryKeyJoinColumn(name = "id")
public class AvionicsEquipment extends DomainEntity implements Serializable {
	
	public static final String EQUIPMENT_TYPE_BUS = "总线";
	public static final String EQUIPMENT_TYPE_OUTTER_DEVICE = "外部设备";
	public static final String EQUIPMENT_TYPE_INNER_DEVICE = "内部设备";
	
	private static final long serialVersionUID = 1L;

	private EquipmentCategory category;

	private Set<EquipmentPropertyInstance> propertyInstances;
	
	private String equiptype;

	
	@Column(name = "equiptype", nullable = false, length = 32)
	public String getEquiptype() {
		return equiptype;
	}

	public void setEquiptype(String equiptype) {
		this.equiptype = equiptype;
	}

	@ManyToOne(cascade = CascadeType.REFRESH)
	@JoinColumn(name = "category_id", nullable = true)
	public EquipmentCategory getCategory() {
		return category;
	}


	public void setCategory(EquipmentCategory category) {
		this.category = category;
	}

	@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "equipment")
	public Set<EquipmentPropertyInstance> getPropertyInstances() {
		return propertyInstances;
	}	

	public void setPropertyInstances(
			Set<EquipmentPropertyInstance> propertyInstances) {
		this.propertyInstances = propertyInstances;
	}

}
